package com.tanjie.blackbean.schedule.properties;

import com.tanjie.blackbean.schedule.support.ScheduleExecutionType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: tanjie
 * @date: 2022-04-14
 **/
@Data
@ConfigurationProperties(prefix = "blackbean.schedule")
public class ScheduleConfigProperties {

    Boolean enable = true;

    Boolean runOnStart = true;

    String threadNamePrefix = "ThreadPoolTaskScheduler";

    List<ScheduleConfig> scheduleConfigList = new ArrayList<>();

    @Data
    public static class ScheduleConfig {

        String id;

        String title;

        String taskName;

        ScheduleExecutionType type;

        String cron;

        Long period;

        Boolean enable;

        Boolean runOnStart;

    }

}
